var button = document.querySelector('.login-button');
var panel = document.querySelector('.panel');
var title = document.querySelector('.title-bar');
var login_window = document.querySelector('.login-window');
var close_button = document.querySelector('.close-button');
panel.style.display = 'none';

button.addEventListener('click', function() {
    if (panel.style.display == 'none') {
        panel.style.display = 'block';
    }
})

close_button.addEventListener('click', function() {
    panel.style.display = 'none';
})


title.addEventListener('mousedown', function(e) {
    var x = e.pageX - login_window.offsetLeft;
    var y = e.pageY - login_window.offsetTop;
    document.addEventListener('mousemove', move);
    document.addEventListener('mouseup', function(e) {
        document.removeEventListener('mousemove', move);
    })
    function move(e) {
        login_window.style.left = e.pageX - x + 'px';
        login_window.style.top = e.pageY - y + 'px';
    }
})

